home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part1 / 6177 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  2.5 KB

  1. Path: qualcomm.com!usenet
  2. From: nababs@qualcomm.com (Nasser Abbasi)
  3. Newsgroups: comp.lang.c++
  4. Subject: Re: What is Object Oriented Programming (OOP)?
  5. Date: 11 Feb 1996 10:53:55 GMT
  6. Organization: Qualcomm Inc.
  7. Message-ID: <4fkhs3$b1g@qualcomm.com>
  8. References: <4f1nj6$4cie@news-s01.ny.us.ibm.net> <4fcv70$7tl@rockall.cc.strath.ac.uk>
  9. NNTP-Posting-Host: nabbasi.qualcomm.com
  10. Mime-Version: 1.0
  11. X-Newsreader: WinVN 0.93.14
  12.  
  13. In article <4fcv70$7tl@rockall.cc.strath.ac.uk>, 
  14. scott.russell@strath.ac.uk says...
  15. >It is difficult to find a text book which 
  16. >defines exactly what an object really is.
  17.  
  18.  
  19. Yes. But I really would not worry about finding an "official" 
  20. definition for an object, a simple way to look at it is to think of an 
  21. object as an entity that can take different values and have operations
  22. defined on it to modify the value of the entity.
  23.  
  24. now, different terms can be used to describe some of the above words.
  25. the value of the object at any time, can be called the state of the 
  26. object, ie.an object is supposed to have internal state, doing an 
  27. operation on an object, can be called sending a message to the object. 
  28.  
  29. as a simple example, a variable of type integer is an "object".
  30.  
  31. This object can take on values (1,2,-4,5, etc...), at any one time, i.e. 
  32. the object has one of these values, i.e. its internal state at any one 
  33. time has the value of 1 or 2 or -4 etc..
  34.  
  35. It also have operations defined on it to change its state,
  36. we can define operations of add,subtract,divide,multiply,assignment,copy 
  37. etc.. on objects of type integer. i.e we can "send" an add message to the
  38. object, we pass data with the message that the object internally uses.
  39.  
  40. so, in OO terms,
  41.  
  42. int a;
  43.  
  44. a = 5;
  45.  
  46. Means, create an object of type integer, then send message "assignment" 
  47. to it, with data '5' as parameter of the message, this message causes the 
  48. internal state of the object to change to new state, the value of the new 
  49. state is '5'.
  50.  
  51.  
  52. Complicated objects can have complicate state, one that is a set of many 
  53. sub states, and can support large operations on them. large object can be 
  54. build up from smaller objects, some of the hardest parts of OOA, is 
  55. determining what the objects are.
  56.  
  57. Objects have public interface to them, this tell us what "messages" we 
  58. can send to the object, and the form of the messages, that is really all 
  59. what we need to know about the object (form the most part), the object 
  60. internal state is hidden away from the outside view, to find out what is 
  61. the state of the object we send a message to it to inquire about this.
  62.  
  63. Nasser
  64. who_feels_like_rambling_too_much_tonight
  65.  
  66.